<template>
    <!-- 提示弹窗 -->
    <uni-popup ref="popup" :mask-click="false">
        <div class="container">
            <div class="container-scroll">
                <div class="title"><text class="title-text">编辑昵称</text></div>
                <input class="cutom-input" :value="modelValue"
                    @input="(e: UniHelper.InputOnInputEvent) => $emit('update:modelValue', e.detail.value)" />
            </div>
            <div class="i-know" @click="close">
                <text class="text">确定</text>
            </div>
        </div>
    </uni-popup>
</template>

<script setup lang="ts">
const popup = ref<UniHelper.UniPopupInstance>();
defineProps(['modelValue'])
const emit =defineEmits(['update:modelValue', 'popupClose'])
/** 弹窗打开 */
const open = () => {
  console.log("open")
  if (!popup.value?.open) return;
  popup.value?.open();
};

/** 弹窗关闭 */
const close = () => {
  if (!popup.value?.close) return;
  popup.value?.close();
  emit('popupClose');
};

defineExpose({
  open,
  close,
});


</script>

<style scoped lang="scss">
.container {
    position: relative;

    width: 90vw;
    max-height: 80vh;
    transform: translateY(10vh);

    background: #FFFFFF;
    box-shadow: 0px 7 19px 0px rgba(0, 0, 0, 0.3);
    border-radius: 41rpx 41rpx 41rpx 41rpx;

    padding: 22rpx 16rpx 24rpx;

    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;

    .container-bg {
        position: absolute;
        top: 0;
        left: 0;
        z-index: -1;

        width: 100%;
        height: 100%;
    }

    .container-scroll {
        max-height: 60vh;
        width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
    }

    .title-image {
        position: absolute;
        top: -200rpx;
        z-index: 100;
        width: 572rpx;
        height: 200rpx;
    }

    .title {
        background-image: url("https://ustatic.hudongmiao.com/miao/activity/202505/titleBg.png");
        background-size: 565rpx 90rpx;
        width: 565rpx;
        height: 90rpx;
        display: flex;
        align-items: center;
        justify-content: center;

        .title-text {
            font-weight: 700;
            font-size: 45rpx;
            color: #FFFFFF;
            line-height: 65rpx;
            text-align: justify;
            font-style: normal;
            text-transform: none;
            margin-bottom: 10rpx;
        }
    }

    .cutom-input {
        margin-top: 30rpx;
        width: 565rpx;
        height: 90rpx;
        border-radius: 13rpx 13rpx 13rpx 13rpx;
        border: 2rpx solid #D7D7D7;
        font-weight: 400;
        font-size: 34rpx;
        color: #666666;
        line-height: 37rpx;
        text-align: left;
        font-style: normal;
        text-transform: none;
    }

    .intro-text {
        margin-top: 20rpx;
        width: 565rpx;
        font-weight: 400;
        font-size: 26rpx;
        color: #666666;
        line-height: 37rpx;
        text-align: justify;
        font-style: normal;
        text-transform: none;
    }

    .lottery-content {
        width: 565rpx;
        height: 653rpx;
        background-image: url("https://ustatic.hudongmiao.com/miao/activity/202505/contentBg.png");
        background-size: 100% 100%;
        background-repeat: no-repeat;
        margin-top: 20rpx;
        display: flex;
        justify-content: center;
        align-items: center;

        .lottery-items {
            width: 507rpx;
            height: 591rpx;
            background: #FFFBDD;
            border-radius: 15rpx 15rpx 15rpx 15rpx;

            display: grid;
            grid-template-columns: repeat(3, auto);
            grid-template-rows: repeat(3, auto);
            column-gap: 27rpx;
            row-gap: 9rpx;

            .lottery-item {
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;

                .image {
                    width: 151rpx;
                    height: 151rpx;
                    background-color: #FFFFFF;
                }

                .text {
                    width: 151rpx;
                    height: 40rpx;
                    font-weight: 400;
                    font-size: 19rpx;
                    color: #9B642E;
                    line-height: 40rpx;
                    text-align: center;
                    font-style: normal;
                    text-transform: none;
                }
            }
        }
    }

    .i-know {
        margin-top: 20rpx;
        width: 319rpx;
        height: 95rpx;
        background-image: url("https://ustatic.hudongmiao.com/miao/activity/202505/yellowButton2.png");
        background-size: 319rpx 95rpx;
        display: flex;
        align-items: center;
        justify-content: center;

        .text {
            font-weight: 500;
            font-size: 34rpx;
            color: #FFFFFF;
            line-height: 49rpx;
            text-align: center;
            font-style: normal;
            text-transform: none;
        }
    }

}
</style>